﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace Meraz.Web.Views.Helpers
{
    public static class MenuHelper
    {
        public static string ListItem(string action, string label, IDictionary<string, object> viewData)
        {
            string selectedAction = null;
            if (viewData != null && viewData["Menu"] != null)
                selectedAction = viewData["Menu"].ToString();
            StringBuilder builder = new StringBuilder();
            builder.Append("<li");
            if (action.Equals(selectedAction))
                builder.Append(" class='selected'");
            builder.Append(">");
            builder.AppendFormat("<a href='/{0}'>{1}</a></li>", action, label);
            return builder.ToString();
        }
    }
}